import axios from '@/utils/axios.js'

// 登录 - post
// axios post请求传参:  { }
// axios get请求传参: params:{}
export const getCateList = params =>
  axios({
    method: 'GET',
    url: 'categories',
    params
  })

// 新增分类
export const addCateList = data =>
  axios({
    method: 'POST',
    url: 'categories',
    data
  })

// 删除分类
export const deleteCateById = id =>
  axios({
    method: 'DELETE',
    url: `categories/${id}`
  })

// categories/:id
// 编辑分类 - id:id,cat_name:编辑名字
export const editCateById = data =>
  axios({
    method: 'PUT',
    url: `categories/${data.id}`,
    data
  })
